package com.luoqiz.common.util;

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;

public class LocalDateUtils {

	public static void main(String[] args) {
		LocalTime zero = LocalTime.of(11, 15, 20); // 00:00:00
		LocalTime mid = LocalTime.parse("12:00:00"); // 12:00:00
		LocalTime now = LocalTime.now(); // 23:11:08.006
		System.out.println(zero);
		System.out.println(mid);
		System.out.println(now);
		
		System.out.println(getCurrentZero());
		
	}
	
	//获取凌晨时间
	public static LocalDateTime getCurrentZero() {
		LocalDateTime lt=LocalDateTime.now();
//		DateTimeFormatter formatter =    DateTimeFormatterBuilder.getLocalizedDateTimePattern(dateStyle, timeStyle, chrono, locale);
//		lt.format(formatter);
		System.out.println(lt);
		return lt;
	}
	


	private static int countSubstr(String str, String substr) {
		int fromIndex = 0;
		int count = 0;
		while (true) {
			int index = str.indexOf(substr, fromIndex);
			if (-1 != index) {
				fromIndex = index + 1;
				count++;
			} else {
				break;
			}
		}
		return count;
	}

}
